package com.platform;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
//import org.springframework.boot.autoconfigure.security.oauth2.client.EnableOAuth2Sso;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;


@EnableDiscoveryClient
@SpringBootApplication
//@EnableOAuth2Sso
public class EactServiceApplication {
    public static void main(String[] args) {
        SpringApplication.run(EactServiceApplication.class, args);
        System.out.println("#############");
        System.out.println(" Eact启动完毕");
        System.out.println("#############");
    }

	/*
     * @Bean public FilterRegistrationBean filterRegistrationBean() {
	 * FilterRegistrationBean registrationBean = new FilterRegistrationBean();
	 * HTTPBasicAuthorizeAttribute httpBasicFilter = new
	 * HTTPBasicAuthorizeAttribute();
	 * registrationBean.setFilter(httpBasicFilter); List<String> urlPatterns =
	 * new ArrayList<String>(); urlPatterns.add("/user/*");
	 * registrationBean.setUrlPatterns(urlPatterns); return registrationBean; }
	 */

	  /**
	    * 解决跨域问题
	    * @author 王玉涛
	    * @Param
	    * @date 2017-09-26 9:58
	   */
//    @Bean
//    public FilterRegistrationBean corsFilter() {
//        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
//        CorsConfiguration config = new CorsConfiguration();
//        config.setAllowCredentials(true);
//        // 设置你要允许的网站域名，如果全允许则设为 *
//        config.addAllowedOrigin("*");
//        // 如果要限制 HEADER 或 METHOD 请自行更改
//        config.addAllowedHeader("*");
//        config.addAllowedMethod("*");
//        source.registerCorsConfiguration("/**", config);
//        FilterRegistrationBean bean = new FilterRegistrationBean(new CorsFilter(source));
//        // 这个顺序很重要哦，为避免麻烦请设置在最前
//        bean.setOrder(0);
//        return bean;
//    }

//     @Bean
//     public FilterRegistrationBean jwtFilterRegistrationBean(){
//     FilterRegistrationBean registrationBean = new FilterRegistrationBean();
//     HTTPBearerAuthorizeAttribute httpBearerFilter = new
//     HTTPBearerAuthorizeAttribute();
//     registrationBean.setFilter(httpBearerFilter);
//     List<String> urlPatterns = new ArrayList();
//    // urlPatterns.add("/user/getusers");
//    // urlPatterns.add("/query/queryStation");
//    // urlPatterns.add("/qr/*");
////     urlPatterns.add("/event/*");
//     registrationBean.setUrlPatterns(urlPatterns);
//     return registrationBean;
//     }


}
